package com.coincalf.framework.enums;


/**
 * @Description: 资金流水业务类型
 * @Author: Chen Long
 * @Date: Created in 2018/5/13 下午2:37
 * @Modified by: Chen Long
 */
public enum BusinessType {

    RECHARGE("recharge", "充值")
    , WITHDRAW("withdraw", "提现")
    , WITHDRAW_FEE("withdraw_fee", "提现手续费")
    , TRADE_CREATE("trade_create", "币币交易委托下单")
    , TRADE_CANCEL("trade_cancel", "币币交撤销委托")
    , TRADE_DEAL_ERROR("trade_deal_error", "币币交易撮合异常，解冻")
    , TRADE_DEAL("trade_deal", "币币交易撮合成交")
    , TRADE_DEAL_FEE("trade_deal_fee", "币币交易撮合成交手续费")
    , FOREX_CREATE_FEE("forex_create_fee", "创新交易手续费")
    , FOREX_CREATE_MARGIN("forex_create_margin", "创新交易保证金")
    , FOREX_CANCEL_FEE("forex_cancel_fee", "创新交易撤单手解冻续费")
    , FOREX_DEAL_ERROR_FEE("forex_deal_error_fee", "创新交易撮合异常解冻续费")
    , FOREX_CANCEL_MARGIN("forex_cancel_margin", "创新交易撤单解冻保证金")
    , FOREX_DEAL_ERROR_MARGIN("forex_deal_error_margin", "创新交易撮合异常解冻保证金")
    , FOREX_DEAL_FEE("forex_deal_fee", "成交手续费")
    , FOREX_DEAL_MARGIN("forex_deal_margin", "部分成交手后重新冻结保证金")
    , FOREX_CLOSE_POSITION_PROFIT("forex_close_position_profit", "平仓盈亏")
    , REGISTER_REWARD("register_reward", "注册奖励")
    , INVITE_REWARD("invite_reward", "邀请奖励")
    , HZ_MINE_TO_EX("hz_mine_to_ex", "矿机系统划转到交易所")
    , HZ_EX_TO_MINE("hz_ex_to_mine", "交易所划转到矿机系统")
    ,
    ;

    /**
     *
     */
    private String code;

    /**
     * 标识
     */
    private String desc;

    BusinessType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(String code){
        for(BusinessType type : BusinessType.values()){
            if(type.getCode().equals(code)){
                return type.getDesc();
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
